<?php
$db = new PDO('mysql:host=localhost;dbname=mkmps', 'root', '');
$result = $db->query("show tables");
$tables = $result->fetchAll();
foreach($tables as $tableCtr) {
	$tablename = $tableCtr['Tables_in_mkmps'];
	$sql = "ALTER TABLE $tablename RENAME TO ". str_replace('mymps', 'mk_', $tablename);
	if ($db->query($sql)){
		continue;
	} else {
		exit($db->errorInfo());
	}
}